#
# arch/ckcore/boot/Makefile
#
# This file is subject to the terms and conditions of the GNU General Public
# License.  See the file "COPYING" in the main directory of this archive
# for more details.
#
# Copyright (C) 2020 Hujunshan(junshan_hu@c-sky.com)
#

MKIMAGE := $(srctree)/scripts/mkuboot.sh

targets := Image zImage uImage
extra-y += Image zImage

quiet_cmd_uimage = UIMAGE  $@
      cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A cskycpu -O linux -T kernel \
                   -C gzip -n 'Linux-$(KERNELRELEASE)' -a $(CONFIG_BOOT_LOAD) \
                   -e $(shell $(NM) vmlinux | awk '$$NF == "__start" {print $$1}') \
                   -d $< $@

$(obj)/Image: vmlinux FORCE
	$(call if_changed,objcopy)
	@echo '  Kernel: $@ is ready'

$(obj)/zImage: $(obj)/Image FORCE
	$(call if_changed,gzip)

$(obj)/uImage: $(obj)/zImage
	$(call if_changed,uimage)
	@echo 'Image: $@ is ready'

install:
	sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)


